import java.util.Scanner;

import javax.print.attribute.standard.NumberUp;


public class Main {

	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		System.out.print("要素数：");

		int size = stdIn.nextInt();
//		int size = 5;

		
		int[] ar = new int[size];
		ar = NumbersUtil.createNumbers(size);
		int i = 0;
		for(int v : ar){
			System.out.println("[" + (i++) + "]:"+ v);
		}
		
		System.out.print("探す値：");
		int target = stdIn.nextInt();
//		int target = 5;
		
		int idx = BinarySearch.search(ar, target);
		if( idx == -1 ){
			System.out.println("見つからない");
		}else{
			System.out.println("その値は[" + idx + "]にあります");
		}
		
	}
	

}
